##
## $Header: /pub/cvsroot/mydns/Makefile.am,v 1.19 2002/07/15 00:30:38 bboy Exp $
##

AUTOMAKE_OPTIONS	=	dist-bzip2
SUBDIRS				=	extras intl po m4 lib src pkg doc

SEDFILE				=	version.sed
ACLOCAL_AMFLAGS	=	-I m4

EXTRA_DIST			=	config.rpath QUICKSTART

distready:
	rm -rf mydns-*
	po/mkpotfile

## Creates a small .sed script to replace various variables
## (Used by doc and pkg)
sedfile:
	@if `test -f $(SEDFILE)`; then rm -f $(SEDFILE); fi
	@echo "s,@PACKAGE_DATE\@,@PACKAGE_DATE@,g" >> $(SEDFILE)
	@echo "s,@PACKAGE_NAME\@,@PACKAGE_NAME@,g" >> $(SEDFILE)
	@echo "s,@PACKAGE_VERSION\@,@PACKAGE_VERSION@,g" >> $(SEDFILE)
	@echo "s,@PACKAGE_STRING\@,@PACKAGE_STRING@,g" >> $(SEDFILE)
	@echo "s,@PACKAGE_AUTHOR\@,@PACKAGE_AUTHOR@,g" >> $(SEDFILE)
	@echo "s,@PACKAGE_BUGREPORT\@,@PACKAGE_BUGREPORT@,g" >> $(SEDFILE)
	@echo "s,@PACKAGE_HOMEPAGE\@,@PACKAGE_HOMEPAGE@,g" >> $(SEDFILE)
	@echo "s,@PACKAGE_COPYRIGHT\@,@PACKAGE_COPYRIGHT@,g" >> $(SEDFILE)

clean:
	rm -f core* *~ $(SEDFILE)
	rm -rf @PACKAGE_NAME@-*

install-data-hook:
	@echo
	@echo "***"
	@echo "***  @PACKAGE_NAME@ version @PACKAGE_VERSION@ installed!"
	@echo "***"
	@echo "***  See the file QUICKSTART if you are in a hurry."
	@echo "***  Otherwise, consult the manual (in doc/)."
	@echo "***"
	@echo "***  The MyDNS server program was installed as"
	@echo "***  @sbindir@/mydns."
	@echo "***"
	@echo

## The `config' target creates an /etc/mydns.conf template
conf:
	@if test -f /etc/mydns.conf; then \
		echo "/etc/mydns.conf already exists!  Nothing done."; \
	else \
		mydns --dump-config > /etc/mydns.conf; \
		chmod 0600 /etc/mydns.conf; \
		echo "/etc/mydns.conf created.  See mydns.conf(5) for details."; \
	fi

release: clean distready dist
	$(INSTALL) -m 0644 @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz @WEBROOT@/download
	$(INSTALL) -m 0644 @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.bz2 @WEBROOT@/download
	cd doc && $(MAKE) release
	cd pkg && $(MAKE) release
	$(INSTALL) -m 0644 ChangeLog @WEBROOT@

## vi:set ts=3:
